home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 913 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.9 KB

  1. From: jchristo@mit.edu (James Christodouleas)
  2. Message-ID: <QQajel16319.199603292150@relay1.UU.NET>
  3. X-Original-Date: Fri, 29 Mar 96 16:50:32 EST
  4. Path: in2.uu.net!bounce-back
  5. Date: 30 Mar 96 06:03:06 GMT
  6. Approved: fjh@cs.mu.oz.au
  7. Newsgroups: comp.std.c++
  8. Subject: Re: double const declarations
  9. Organization: Mass Inst of Technology and Draper Laboratory, Inc
  10. References: <4jc2fa$bqu@arl-news-svc-2.compuserve.com> <4jdvnj$o35@mulga.cs.mu.OZ.AU>
  11. X-Auth: PGPMoose V1.1 PGP comp.std.c++
  12.     iQBFAgUBMVzO0OEDnX0m9pzZAQErdAF/VrRXw9RUdvwd1Kd6poveEZykT9DleX4j
  13.     2q+b0hY7EMxKWJjSqPf4iroSWjKOalHc
  14.     =fT3w
  15.  
  16. In article <4jdvnj$o35@mulga.cs.mu.OZ.AU>, fjh@munta.cs.mu.OZ.AU (Fergus
  17. Henderson) wrote:
  18.  
  19. > Philippe Verdy <100105.3120@compuserve.com> writes:
  20. > >template <class T, class CT>
  21. > >class SmartPtr2  {
  22. > >   SmartPtr2(T* p) { mp = const_cast<CT>(p) ; }
  23. > >   CT & Dereference() {
  24. > >     return *mp ;
  25. > >   }
  26. > > private :
  27. > >   CT *mp ;
  28. > >} ;
  29. > >template <class T> class ConstSmartPtr : SmartPtr<T, T> {} ;
  30. > >template <class T> class FreeSmartPtr : SmartPtr<T, const T> {} ;
  31. > You forgot to delegate the constructors.
  32. > (Of course, if C++ supported tempate typedefs, there wouldn't be
  33. > any need to delegate constructors in examples like this.
  34. > Unfortunately it doesn't.)
  35.  
  36. What does it mean to "delegate constructors?"  I looked it up in Coplien,
  37. Advanced C++, and he talks about delegation to mean different classes
  38. sharing functionality dynamically.  
  39.  
  40. What do you mean here?  
  41.  
  42. Jim Christodouleas
  43. jchristo@mit.edu
  44. ---
  45. [ comp.std.c++ is moderated.  To submit articles: try just posting with      ]
  46. [ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu         ]
  47. [ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
  48. [ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
  49. [ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]
  50.